<?php 
require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
require_once($_SERVER['DOCUMENT_ROOT']."/Modules/CMX3458E/modconf.mex"); 	
MYTCONN();

	$cpg_office = '';
	$cpg_product = '';
	if (!isset($_POST['cpg_Campaign'])) { $_POST['cpg_Campaign'] = $_GET['RSID']; }
	if (isset($_POST['cpp_ID']) && $_POST['cpp_ID'] > 0) { $cpg_product = ' AND cpp_ID = '.$_POST['cpp_ID'];}
	if (isset($_POST['cpg_Origen0']) && $_POST['cpg_Origen0'] > 0) { $cpg_office = ' AND cpg_Origen0 = '.$_POST['cpg_Origen0'];}

	$RSGET = $GLOBALS['MYT']->db_array("SELECT OriNombre AS O_ID, DATE(cpg_TStart) AS COL1, DATE(cpg_TEnd) AS COL2, cpg_Limit AS COL3, cpg_Current AS COL4, cpg_Flag AS COL5, cpp_Name AS COL6, cpg_ID 
		FROM campaigns_attrib 
		INNER JOIN origenes ON OriNumero = cpg_Origen0 
		INNER JOIN campaigns_products ON cpp_ID = cpg_Product
		WHERE cpg_Campaign = {$_POST['cpg_Campaign']} {$cpg_product} {$cpg_office}");
	$CARD = $RSGET[0];
	mn_field('hidden','ED','total_update',$RSGET[0],'','','','');
echo '<table width="97%"><tr><td colspan="6"></td></tr>';
  for ($r = 1; $r<=$CARD; $r++) {
	  mn_field('hidden','ED','cpg_ID'.$r,'','','','','');
  echo '<tr bgcolor="'.gridlines($r).'">
    <td style="width:220px" style="padding:2">'.$RSGET[$r]['O_ID'].'</td>
    <td style="width:180px">'.$RSGET[$r]['COL6'].'</td>
    <td style="width:80px">'.$RSGET[$r]['COL1'].'</td>
    <td style="width:80px">'.$RSGET[$r]['COL2'].'</td>
    <td align="right">'; mn_field('text','ED','cpg_Limit'.$r,$RSGET[$r]['COL3'],'3','3','','INPNUM" onclick="
		document.campaign_dt.cpg_ID'.$r.'.value='.$RSGET[$r]['cpg_ID'].';" onkeydown="
		document.campaign_dt.cpg_ID'.$r.'.value='.$RSGET[$r]['cpg_ID'].';'); echo '</td>
    <td align="right">'; mn_field('text','ED','cpg_Current'.$r,$RSGET[$r]['COL4'],'3','3','','INPNUM" onclick="
		document.campaign_dt.cpg_ID'.$r.'.value='.$RSGET[$r]['cpg_ID'].';" onkeydown="
		document.campaign_dt.cpg_ID'.$r.'.value='.$RSGET[$r]['cpg_ID'].';'); echo '</td>
  </tr>';
  }
echo '</table>'; ?>
